/**
 * @作者 faner
 * @创建时间 2021/1/8 16:12
 */
package com.faner.fast.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Arrays;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum  GenderEnum {
    MALE(1,"男"),
    FEMALE(2,"女"),
    UNKNOWN(0,"未知");

    //业务状态码
    private Integer code;
    private String description;

    public static GenderEnum getGenderEnum(String code){
        GenderEnum genderEnum = Arrays.stream(GenderEnum.values())
                .filter(t->t.getCode().equals(code))
                .findFirst()
                .get();
        return genderEnum;
    }
}
